Astroid analysis

library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(readr)
library(leaflet)
library(ggplot2)

import data

astroids <- read_csv("Meteorite_Landings.csv", col_types = cols(year = col_character()))
astroids = astroids %>% 
  rename (mass = `mass (g)` ) %>% 
  mutate( 
    date =  as.POSIXct(year,format="%d/%m/%Y %H:%M:%OS"), 
    recency = 2020 - lubridate::year(date)
  )

head(astroids,7)
## # A tibble: 7 x 12
##   name     id nametype recclass   mass fall  year  reclat reclong
##   <chr> <dbl> <chr>    <chr>     <dbl> <chr> <chr>  <dbl>   <dbl>
## 1 Aach…     1 Valid    L5           21 Fell  01/0…   50.8    6.08
## 2 Aarh…     2 Valid    H6          720 Fell  01/0…   56.2   10.2 
## 3 Abee      6 Valid    EH4      107000 Fell  01/0…   54.2 -113   
## 4 Acap…    10 Valid    Acapulc…   1914 Fell  01/0…   16.9  -99.9 
## 5 Achi…   370 Valid    L6          780 Fell  01/0…  -33.2  -65.0 
## 6 Adhi…   379 Valid    EH4        4239 Fell  01/0…   32.1   71.8 
## 7 Adzh…   390 Valid    LL3-6       910 Fell  01/0…   44.8   95.2 
## # … with 3 more variables: GeoLocation <chr>, date <dttm>, recency <dbl>

Histogram of logg mass

astroids = astroids %>% 
  filter( recency >= 0) %>% 
  mutate(
    log_mass = log10(mass)
  )

ggplot(astroids,aes(x=log_mass)) + geom_histogram(col = "black")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 131 rows containing non-finite values (stat_bin).

ggplot(astroids,aes(x=recency)) + geom_histogram(col = "black")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

leaflet map

Interactive map of astroid locations

greens <- colorNumeric("Reds", domain = NULL)

leaflet(
  data = astroids, 
  width = "1400px", height = "1100px",
  ) %>% 
  addTiles() %>% 
  addCircleMarkers(
    ~reclong, ~reclat,
    label = ~name, 
    radius = ~0.8*log_mass,stroke = TRUE, weight = 2,
    fillOpacity = .75,
    color = ~greens(recency)
  )
## Warning in validateCoords(lng, lat, funcName): Data contains 7202 rows with
## either missing or invalid lat/lon values and will be ignored